<template>
    <div class="UserDetail" v-if="userInfo!=null">
        <img class="headimg" :src="userInfo.headimg" alt="">
        <div>
            用户昵称： {{userInfo.nickname}}
        </div>
        <div>
            手机号码： {{userInfo.phone}}
        </div>
        <div>
            用户类型： {{userInfo.statusStr}}
        </div>
        <div>
            创建时间： {{userInfo.createDate}}
        </div>

        <div class="title">
            该用户发布的公告
        </div>
        <el-row :gutter="20">
          <el-col :span="8" v-for="item of notices" :key="item.noticeId" >
            <div class="item" @click="noticeDetail(item)" >
                <notice :notice="item"></notice>
            </div>
          </el-col>
        </el-row>
    </div>
</template>
<script>
// @ 是 /src 的别名
import notice from '../../components/notice_component.vue';
export default {
    name: 'UserDetail',
    props: {
		
    },
    data() {
        return {
					notices: [],
					userInfo: null
        }
    },
		created:function(){
			this._getUserInNotice();
			this._getUserInfo();
		},
    methods: {
			_getUserInNotice() {
				this.axios.get('/admin/noticeByUser?pageNum='+1+'&pageSize='+999999+'&openId='+this.$route.params.id)
				.then((res)=>{
						this.notices = res.data.data.list
						console.log(this.notices)
				})
			},
			_getUserInfo() {
				this.axios.get('/admin/userByOpenid?&openId='+this.$route.params.id)
				.then((res)=>{
						console.log(res.data)
						this.userInfo= res.data
				})
			},
			noticeDetail(obj) {
				this.$router.push("/notice/detail/"+obj.noticeId);
			}
    },
    components: {
        notice
    }
}
</script>
<style scoped lang="styl">
.title{
    margin: 20px 0 10px 0;
}
.item {
    margin-top: 20px;
    cursor: pointer;
		height: 200px;
}
.UserDetail .headimg{
    width: 100px;
    height: 100px;
    border-radius: 50%;
		/* margin: 0px 0 15px; */
}

</style>